package com.youlu.campus.admin.platform;

import com.youlu.campus.entity.PointPlatformTaskConfigQueryVO;
import com.youlu.campus.entity.platform.PlatformTaskInfo;
import com.youlu.campus.service.platform.PointPlatformTaskConfigService;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * 积分平台配置任务控制器
 */
@RestController
public class PointPlatformTaskConfigController {
    @Autowired
    private PointPlatformTaskConfigService pointPlatformTaskConfigService;

    @PostMapping("/point/platform-task-config/list")
    public QResult list(@RequestBody @NotNull PointPlatformTaskConfigQueryVO req) {
        return QResult.success(pointPlatformTaskConfigService.find(req));
    }

    @PostMapping("/point/platform-task-config/update")
    public QResult updatePlatformConfig(@RequestBody PlatformTaskInfo config) {
        return QResult.success(pointPlatformTaskConfigService.update(config));
    }

    @PostMapping("/point/platform-task-config/create")
    public QResult createPlatformConfig(@RequestBody @NotNull PlatformTaskInfo config) {
        return QResult.success(pointPlatformTaskConfigService.create(config));
    }

    @PostMapping("/point/platform-task-config/delete")
    public QResult delete(@RequestParam("id") String id) {
        return QResult.success(pointPlatformTaskConfigService.delete(id));
    }

    @GetMapping("/point/platform-task-config/find-one")
    public QResult findOne(@RequestParam("id") String id) {
        return QResult.success(pointPlatformTaskConfigService.findOne(id));
    }

}
